﻿<cfsilent>
	<cfscript>
	
		event.setArg("pageTitle", "系统管理 - 消息推送");
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		userId = sessionAdvice.getAutherUserID();
		
		targetArgs = structNew();

		currentTab = "labFormClass";
	</cfscript>
</cfsilent>

<link rel="stylesheet" href="../kindediter/themes/default/default.css" />
<script charset="utf-8" src="../kindediter/kindeditor-min.js"></script>
<script charset="utf-8" src="../kindediter/lang/zh_CN.js"></script>

<script>
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="Describe"]', {
					
					uploadJson : '../kindediter/jsp/upload_json.jsp',

					fileManagerJson : '../kindediter/jsp/file_manager_json.jsp',
					<cfif userId eq '001'>
						allowFileManager : true,
						items:[
							   'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
							   'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
							   'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
							   'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
							   'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
							   'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image','multiimage',
							   'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'code', 'pagebreak',
							   'link', 'unlink'
						],
						<cfelse>
						items : [
						'fontname', 'fontsize', '|',  'undo', 'redo', '|','forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'hr', 'emoticons', 'image', 'insertfile','baidumap','link','|', 'fullscreen'],
					</cfif>
					 afterBlur: function(){this.sync();}
				});
				
			});
		</script>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT', targetArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">返回</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 course"></i>消息推送
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labFormClass">class="active"</cfif> id="labFormClass" tabTarget="FormClass">信息</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
			
				
				<div id="FormClass" class="tabContent">
					
					<div id="formBox" class="">
						
						<form id="formCreate" onSubmit="javascript:return processCreate();" class="formWrapper" method="post" action="<cfoutput>#buildURL('messageAdd')#</cfoutput>">
							
							<input type="hidden" name="userID" id="userID" value="" />
                                   
							<div class="label">
								<b>目标</b>
								<input name="userName" id="userName" type="text" disabled="disabled" style="width:220px" class="typeTextDynamic " verification="required" value="" /><span id="teacherTrigger" class="btnSearch"></span>
							</div>
                                   
                                   <div class="label">
								<span class="req">*</span><b>主题</b>
								<input name="subject" id="subject" type="text" verification="required" style="width:320px"  maxlength="100" value="" />
							
							</div>
                                   
                                   <div class="label">
								<span class="req">*</span><b>是否可以回复</b>
								<input name="isReply" id="isReply" class="typeRadio" type="radio" value="1" checked="checked"/>是
                                        <input name="isReply" id="isReply" class="typeRadio" type="radio" value="2" />否
							
							</div>
							
							<div class="label">
								<span class="req">*</span><b>内容</b>
								 
							</div>
							<textarea id="Describe" name="Describe" style="width:700px;height:300px;"></textarea>
							<hr/>
							
							<div class="lable">
								<input class="button" type="submit" value="提交" />
							</div>
							
						</form>
						
						<script language="javascript" type="text/javascript">
							//<![CDATA[
							<!--
							
							<cfif event.getArg("dict") eq 'success'>
								alert("提交成功！");
							</cfif>
							
							function processCreate() {
								
								
								var userID = $("#userID").val();
								var subject = $("#subject").val();
								var Describe = $("#Describe").val();
								
								if (userID != "") {
									
									if(subject == ""){
										alert("主题不能为空");
										$("#subject").focus();
										return false;
									}
									
									if(Describe == ""){
										alert("内容不能为空");
										$("#Describe").focus();
										return false;
									}
									return processVerfiyForm('formCreate');
									
								}
								else {
									alert("请先指定对象");
									
									$("#formBox").addClass("hidden_elem");
									$("#teacherBox").removeClass("hidden_elem");
									
									return false;
								}
								
							}
							
							$(document).ready(function() {
								
								$("#teacherTrigger").click(function(){

									$("#formBox").addClass("hidden_elem");
									$("#teacherBox").removeClass("hidden_elem");

								});
								
								$("#formReset").click(function(){
									
									$("#classBox").removeClass("hidden_elem");
									$("#formBox").addClass("hidden_elem");
									
								});
									
							});
							// -->
							//]]>
						</script>
						
					</div>
                         
                     </div>
					
					<div id="teacherBox" class="hidden_elem">
						
						<form id="formSearch" class="formWrapper Transparent" method="post">
							<div class="label">
								<b>教师\学生姓名或职工号</b>
								<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
							</div>
                                   <div class="label">
								<b>对象</b>
								<select name="user_type" id="user_type">
										<option value="1"><cfoutput>教师</cfoutput></option>
                                                  <option value="2"><cfoutput>学生</cfoutput></option>
								</select>
							</div>
							<hr/>
							<div class="lable">
								<input class="button1" type="submit" value="搜索用户" />
								<input id="formSearchReset" class="button" type="button" value="返回" />
							</div>
						</form>
						
						<div id="formSearchResult" class="UICardTable"></div>
						
						<script language="javascript" type="text/javascript">
							//<![CDATA[
							<!--
							$("input#formSearchReset").click(function(){
								
								$("#formBox").removeClass("hidden_elem");
								$("#teacherBox").addClass("hidden_elem");
								
							});
							
							$("#formSearch").submit(function(){
								
								 $.getJSON(
										 '<cfoutput>#buildURL("getUserByKeywords")#</cfoutput>',
										 {
											 'Keywords': $("form#formSearch input#Keywords").val(),
											 'userType': $("#user_type").val(),
											 'seed': (new Date()).getTime()
										 },
										 function(data) {
											 
											 $div = $("div#formSearchResult").html("").removeClass("hidden_elem");
											 $("div#formBox").addClass("hidden_elem");
											 
											 for (var i=0; i<data.length; i++) {
									
												 var $element = $("<dl><dt><a><i class='sex" + data[i][2] + "'></i><dd><h3>" + data[i][1] + "</h3><p>(" + data[i][0] + ")</p></dd></a></dt></dl>");
												 
												 $element
													 .attr({
														 'userID' : data[i][0],
														 'userName' : data[i][1]
													 })
													 .click(function(){
														 
														 var name = $(this).attr('userName');
														 var id = $(this).attr('userID');
														 
														 $("form#formCreate input#userID").val(id);
														 $("form#formCreate input#userName").val(name + "(" + id + ")");
														 
														 /* backForm */
														 $("#formBox").removeClass("hidden_elem");
														 $("#teacherBox").addClass("hidden_elem");
																											 
													 })
													 .appendTo($div);
												 
											 }
											 
										 });
								
								return false;
							});
							
							// -->
							//]]>
						</script>
						
					</div>

					
				
				
			</div>
		</li>
	</ul>
</div>